<?php
include_once ("databaseconnection.php");
   $_SESSION['successacc']="";
$First_Name=$_POST['First_Name'];
$Last_Name=$_POST['Last_Name'];
$NIC_Number=$_POST['NIC_Number'];
$E_Mail=$_POST['E_Mail'];
$Access_Type=$_POST['Access_Type'];
if($First_Name!=""&&$Last_Name!=""&&$NIC_Number!=""&&$E_Mail!=""&&$Access_Type!="")
	{
	 date_default_timezone_set("Europe/Paris");
    $t_d=date("Y/m/d");
	$Log_Username=$_SESSION['username'];
$sql=mysql_query("UPDATE user SET First_Name='$First_Name',Last_Name='$Last_Name',NIC_Number='$NIC_Number',Access_Type='$Access_Type',E_Mail='$E_Mail',Last_Updated_Date='$t_d' WHERE Login_Username='$Log_Username'");
if($sql)
  {
  unset($_SESSION['Access_Type']);
  unset($_SESSION['First_Name']);
  unset($_SESSION['Last_Name']);
 $_SESSION['Access_Type']=$Access_Type;
 $_SESSION['First_Name']=$First_Name;
 $_SESSION['Last_Name']=$Last_Name;
$_SESSION['successacc']="succ";
}
if(!$sql)
  {
$_SESSION['error']="Sorry unable to change your account please try again!";
}
  
  }
  if($First_Name==""||$Last_Name==""||$NIC_Number==""||$E_Mail==""||$Access_Type=="")
	{
	$_SESSION['error']="All details are required!";
    }
 ?>